#ifndef __platform_info_H__
#define __platform_info_H__ 1
#include "sys.h"
#include "thread_pool.h"
#include "dial_strategy.h"
#include "comm_param.h"
#include "devinfo.h"
#include "heart.h"
#include "trans.h"



#define PROBE_TAR_FILE "onuProbe.tar.gz"
#define PROBE_VERSION_FILE "version.txt"
#define ALL_LOG_FILE "all.txt"

#if 0
#define WEB_AUTH_PATH "gnsts-tv-probe/tvDialAction/authentication.action"
#define WEB_DIAL_REQ_PATH "gnsts-tv-probe/tvDialAction/tvDialSpeedRequest.action"
#define WEB_SPEED_NODE_PATH "gnsts-tv-probe/tvDialAction/getSpeedNodes.action"
#define WEB_DOWNLOAD_PROBE_PATH "gnsts-tv-probe/tvDialAction/downloadProbe.action"
#define WEB_PUSH_PROBE_UPLOAD_PATH "gnsts-tv-probe/tvDialAction/pushProbeUpload.action"
#endif

#if TV_PROJECT
    #define ONU_PROBE_EXE "tvProbe"
    #define ONU_LOADER_EXE "tvLoader"
    #define ONU_MONITOR_EXE "tvMonitor"
    #define WEB_AUTH_PATH "gnsts-tvdail-probe/dialAction/authentication.action"
    #define WEB_DIAL_REQ_PATH "gnsts-tvdail-probe/dialAction/dialSpeedRequest.action"
    #define WEB_SPEED_NODE_PATH "gnsts-tvdail-probe/dialAction/getSpeedNodes.action"
    #define WEB_DOWNLOAD_PROBE_PATH "gnsts-tvdail-probe/dialAction/downloadProbe.action"
    #define WEB_PUSH_PROBE_UPLOAD_PATH "gnsts-tvdail-probe/dialAction/pushProbeUpload.action"
    #define WEB_GET_SPEED_TACTICS_PATH "gnsts-tvdail-probe/dialAction/getSpeedTactics.action"//主动测试
    #define WEB_PUSH_SPEED_DATA_PATH "gnsts-tvdail-probe/dialAction/pushSpeedData.action"//主动测试结果上报
#else
    #define ONU_PROBE_EXE "onuProbe"
    #define ONU_LOADER_EXE "onuLoader"
    #define ONU_MONITOR_EXE "onuMonitor"
    #define WEB_AUTH_PATH "fomsts-gateway-probe/dialAction/authentication.action"
    #define WEB_DIAL_REQ_PATH "fomsts-gateway-probe/dialAction/dialSpeedRequest.action"
    #define WEB_SPEED_NODE_PATH "fomsts-gateway-probe/dialAction/getSpeedNodes.action"
    #define WEB_DOWNLOAD_PROBE_PATH "fomsts-gateway-probe/dialAction/downloadProbe.action"
    #define WEB_PUSH_PROBE_UPLOAD_PATH "fomsts-gateway-probe/dialAction/pushProbeUpload.action"
    #define WEB_GET_SPEED_TACTICS_PATH "fomsts-gateway-probe/dialAction/getSpeedTactics.action"//主动测试
    #define WEB_PUSH_SPEED_DATA_PATH "fomsts-gateway-probe/dialAction/pushSpeedData.action"//主动测试结果上报
    // #define WEB_REPORT_CLIENT_USAGE_PATH "fomsts-gateway-probe/dialAction/reportClientUseInfo.action"//上报CPU,MEM状态信息
#endif

typedef struct{
    HeartInfo_t heartinfo;
    thread_pool_t *tpool;
    struct {
        char host[128];
        uint16_t tcp_port, udp_port;
        char scheme[16];//http, maybe https
    }addr;
    struct {
        char token[64];
        char *logReportUrl, *clientPerformanUrl;
        struct Dial_Task task;
    }resp;
}Platform_t;

int platform_init(Platform_t* platform, char* svr_host, uint16_t tcp_port, uint16_t udp_port, char* scheme);
int platform_auth(Platform_t* platform);
int platform_dial_req(Platform_t* platform);
int platform_task_run(Platform_t *platform);
int platform_download_probe(Platform_t* platform);
int platform_push_probe_upload_report(Platform_t* platform, int cmd_id, int status);
#endif